package net.shopxx.service.impl;

import javax.annotation.Resource;

import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;

import net.shopxx.runner.TaobaoProductCollectRunner;
import net.shopxx.runner.TaobaoProductConvertRunner;
import net.shopxx.service.TaobaoCollectService;

@Service("taobaoCollectServiceImpl")
public class TaobaoCollectServiceImpl implements TaobaoCollectService {

	@Resource(name = "taskExecutor")
	private TaskExecutor taskExecutor;
	@Resource(name = "taobaoProductCollectRunner")
	private TaobaoProductCollectRunner taobaoProductCollectRunner;
	@Resource(name = "taobaoProductConvertRunner")
	private TaobaoProductConvertRunner taobaoProductConvertRunner;
	
	@Override
	public void doCollect(String ids) {
		taobaoProductCollectRunner.setIds(ids);
		taskExecutor.execute(taobaoProductCollectRunner);
	}

	@Override
	public void doConvert() {
		taskExecutor.execute(taobaoProductConvertRunner);
	}

}
